package my.edu.model.bills.sales.entity.dto;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.Valid;
import jakarta.validation.constraints.*;
import jakarta.validation.groups.Default;
import lombok.Data;
import my.edu.common.validate.groups.Insert;
import my.edu.model.bills.purchase.entity.dto.PurchaseSalesExpensesDTO;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;

@Data
public class SalesDTO {
    @Null(message = "id必须为空", groups = {Insert.class})
    @NotNull(message = "id不能为空", groups = {Default.class})
    private Long id;
    @NotBlank(message = "编号不能为空", groups = {Default.class})
    private String orderNo;
    @NotNull(message = "日期不能为空", groups = {Insert.class})
    private LocalDate orderDate;
    private LocalDate deliveryDate;
    private String customerAddress;
    private String customerName;
    @NotNull(message = "客户id不能为空", groups = {Insert.class})
    @Min( value = 1, message = "客户id至少为1", groups = {Insert.class})
    private Long customerId;//客户ID
    private String customerCategory;//客户类别
    private BigDecimal discountRate;//优惠率
    @Min(value = 0, message = "金额必须大于0", groups = {Insert.class})
    private BigDecimal discountAmount;//收款优惠
    @Min(value = 0, message = "金额必须大于0", groups = {Insert.class})
    private BigDecimal amountAfterDiscount;//优惠后金额
    @Min(value = 0, message = "金额必须大于0", groups = {Insert.class})
    private BigDecimal customerBearExpense;//客户承担费用
    @Min(value = 0, message = "金额必须大于0", groups = {Insert.class})
    private BigDecimal receivedAmount;//已收款金额
    private BigDecimal debt;//欠款
    private BigDecimal salesExpense;//销售费用
    private String paymentChannel;//支付通道
    private String deliveryMethod;//交货方式
    private String paymentTerms;//收款条件
    @Min(value = 0, message = "数量必须大于0", groups = {Insert.class})
    private Integer quantity;
    private String remark;//备注
    private Long prepaymentOrderId;//预收款单ID
    private String prepaymentOrderNo;//预收款单编号
    private BigDecimal prepaymentAmount;//预收款金额
    private Long routeId;//线路ID
    private String routeName;//
    private Long settlementAccountId;//结算账户ID
    private String settlementAccountName;//
    private Long salespersonId;//销售人员ID
    private String salespersonName;//
    private String logisticsCompany;
    private Long logisticsId;//物流单ID
    private String logisticsNo;


    @Valid
    @NotEmpty(message = "订单详情不能为空", groups = {Insert.class})
    private List<SalesDetailDTO> salesDetailDTOList;
    private List<PurchaseSalesExpensesDTO> salesExpensesDTOList;

}
